package leetcode.code0941;

import leetcode.IDebug;

public class Solution implements IDebug {

	public boolean validMountainArray(int[] arr) {
		int len = arr.length;
		if (len < 3) {
			return false;
		}
		int l = 1;
		while (l < len - 1 && arr[l] > arr[l - 1]) {
			l++;
		}
		l -= 1;
		if (l == 0) {
			return false;
		}
		int r = len - 2;
		while (r >= l && arr[r] > arr[r + 1]) {
			r--;
		}
		r += 1;
		if (r == len) {
			return false;
		}
		return l == r;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
